package com.flower.config.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @ClassName NacosConfigController
 * @Date2021/07/23
 * @Description Nacos 配置中心控制器
 * @author wuhanxiong
 */
@Controller
@RequestMapping("/config/")
@RefreshScope//实现配置自动更新(热更新)
public class NacosConfigController {

    @Value("${server.port:8080}")
    private String serverPort;

    @RequestMapping("get")
    @ResponseBody
    public String get(){
        return serverPort;
    }

}
